﻿@{
    ViewData["Title"] = "Home Page";
}


<div id="app">
    <div class="alert" v-bind:class="{'alert-success': server.isSuccess, 'alert-danger': !server.isSuccess}" role="alert">
        <strong v-if="server.isSuccess">服务器状态正常</strong>
        <strong v-if="!server.isSuccess">服务器状态异常</strong>
        <p v-if="!server.isSuccess">
            {{ server.msg }}
            {{ server.exception }}
        </p>
    </div>
    
    <div class="card">
        <div class="card-body">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">序列号</th>
                        <th scope="col">设备状态</th>
                        <th scope="col">模型</th>
                        <th scope="col">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(device, index) of devices">
                        <td>{{ index + 1 }}</td>
                        <td>{{ device.serial }}</td>
                        <td>{{ states[device.state] }}</td>
                        <td>{{ device.model }}</td>
                        <td>
                            <span class="badge" v-show="device.executor_status">
                                {{ executor_status[device.executor_status] }}
                            </span>

                            @*<button class="btn btn-primary" v-show="!device.executor_status"
                                    @@click="executeScript(device)">执行脚本</button>*@
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

@section Scripts
{
<script src="~/lib/vue/dist/vue.min.js"></script>
<script src="~/lib/signalr/dist/browser/signalr.min.js"></script>
<script src="~/js/adb.js"></script>
}
